<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePrescriptionInfosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('prescription_infos', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('enterprise_id')->default(0)->comment('商家id');
            $table->bigInteger('user_drug_id')->default(0)->comment('用药人id');
            $table->tinyInteger('has_prescription')->default(0)->comment("是否有处方 0：否 1：是");
            $table->string('perscriptionNumber')->nullable()->default('')->comment('处方单号');
            $table->integer('perscriptionStatus')->nullable()->default(0)->comment('处方状态(0-未提交审核 1-等待医生接诊 3-医生已接诊 5-医生已完成开方 99-医生拒绝开方)');
            $table->text('diagnoseDescription')->nullable()->comment('患者主述');
            $table->string('diagnosticLevel')->nullable()->default('')->comment('诊断级别(1-普通患病并已确诊2-慢性病并确诊 3-尚未确诊)');
            $table->string('drugUsage')->nullable()->default('')->comment('既往用药情况(1-药物用完需继续购买完成疗程 2-医生建议使用此药)');
            $table->string('checkDoctorName')->nullable()->default('')->comment('药店审核医师名称');
            $table->string('reviewDoctorName')->nullable()->default('')->comment('药店复核医师名称');
            $table->text('refuse_reason')->nullable()->comment('拒绝开方原因');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_prescription_infos');
    }
}
